//
//  SLFriendManager.m
//  StarLight
//
//  Created by 吴涛 on 16/6/10.
//  Copyright © 2016年 Duke.Wu. All rights reserved.
//

#import "SLFriendManager.h"
#import "SLNetWork.h"



@implementation SLFriendManager





- (void)operFriendWithHuid:(NSInteger)huid opers:(NSString *)oper block:(FriendSuccessBlock)block{
  NSString *uid = [DEFAULTS objectForKey:loginInfo][@"id"];
  NSDictionary *para = @{@"uid":uid,@"huid":@(huid),@"oper":oper};
  
  [self operFriendWithPara:para success:^{
    block();
  }];
}


- (void)addFriendWithHuid:(NSInteger)huid opers:(NSString *)oper bz:(id)note block:(FriendSuccessBlock)block{
  NSString *uid = [DEFAULTS objectForKey:loginInfo][@"id"];
  NSDictionary *para = @{@"uid":uid,@"huid":@(huid),@"oper":oper,@"bz":note};
 
  [self operFriendWithPara:para success:^{
    block();
  }];
}



- (void)operFriendWithPara:(NSDictionary *)para success:(FriendSuccessBlock)block{
  NSString *postUrl = [NSString backUrlWithService:@"user" methodName:@"relation"];
  
  [SLNetWork postDataWithParameters:para postUrl:postUrl complete:^(id respond, NSError *error) {
    
    if (!error) {
      block();
    }
  }];
}



@end
